#!/bin/bash
#############
#Date 2022/8/29
#mail it-arch
#############
echo "##########################################"
echo "Auto Install Tomcat+jdk                 ##"
echo "Press Ctrl + C to cancel                ##"
echo "Any key to continue                     ##"
echo "##########################################"
read -n 1
/etc/init.d/iptables status >/dev/null 2>&1
if [ $? -eq 0 ]
then
iptables -I INPUT -p tcp --dport 27017 -j ACCEPT && 
iptables -I INPUT -p tcp --dport 28017 -j ACCEPT &&
iptables-save >/dev/null 2>&1
else
    echo -e "\033[32m iptables is stopd\033[0m"
fi
sed -i "s/SELINUX=enforcing/SELINUX=disabled/"  /etc/selinux/config
setenforce 0
################################
yum install java-1.7.0-openjdk-demo.x86_64  java-1.7.0-openjdk-javadoc.noarch java-1.7.0-openjdk-src.x86_64 -y
if [ -d /opt ];then
    cd /opt
else
    mkdir -p /opt && cd /opt
fi
yum -y install wget
yum groupinstall "Development tools" -y
wget -c -O /opt/tomcat.tar.gz http://apache.fayea.com/tomcat/tomcat-7/v7.0.70/bin/apache-tomcat-7.0.70.tar.gz
tar -zxvf tomcat.tar.gz
mv apache-tomcat-7.0.70 tomcat
cd  tomcat/bin
bash startup.sh
netstat -lntup | grep tomcat

